<template>
	<view class="m-b-25 p-25 bg-white radius-15 pintuan-box">
		<image class="pintuan-bg" :src="handleStaticResources('/static/images/pintuan-bg.jpg')"></image>
		<view class="pintuan-good-box">
			<view class="title-box">
				<text class="tit">{{ props.data.title }}</text>
				<coreshop-view-more @hanldeClickViewMore="hanldeClickViewMore" color="#fff"
					:icon="handleStaticResources('/static/images/icon/icon-rigth-fff.png')" />
			</view>
			<scroll-view :scroll-x="true" class="m-t-25 pintuan-list" :enable-flex="true">
				<view v-for="item, index in props.data.list" :key="index" class="card-box">
					<coreshop-goods-card imgWidth="290rpx" imgHeight="290rpx" type="vertical"
						:goodsData="hanldeCombinationGoodsData(item)" @hanldeClickGoods="hanldeClickGoods">
						<template #goodPrice>
							<view class="price-msg" @click="hanldeClickGoods(item)">
								<view class="price-box">
									<view class="price">
										<text class="symbol">￥</text>
										<text class="num">{{ item.pinTuanPrice }}</text>
									</view>
									<view class="underlin-price">￥{{ item.mktPrice }}</view>
								</view>
								<view class="btn">立即下单</view>
							</view>
						</template>
					</coreshop-goods-card>
				</view>
			</scroll-view>
		</view>
	</view>
</template>
<script setup lang="ts">
	import { handleStaticResources, handleRouteNavigateTo } from '@/core/utils';

	const props = withDefaults(defineProps<{
		data : any,
	}>(), {
		data: {},
	});

	// 组合商品数据传入组件
	const hanldeCombinationGoodsData = (item : any) => {
		return {
			id: item.id,
			image: item.goodThumbnail,
			name: item.name,
			brief: item.goodBrief,
			price: item.pinTuanPrice,
			mktprice: item.mktPrice,
		}
	}

	const hanldeClickViewMore = () => {
		handleRouteNavigateTo('/pages/subpackage/activity/pinTuan/list/list');
	}

	const hanldeClickGoods = (data : any) => {
		handleRouteNavigateTo(`/pages/subpackage/activity/pinTuan/detail/detail?id=${data?.id}`)
	}
</script>
<style lang="scss" scoped>
	@import './home-pinTuan.scss';
</style>